import { IPEndPoint } from "./IPEndPoint";

export enum ChannelType {
    Connect,
    Accept,
}

export class Packet {
    public static readonly MinPacketSize = 2;
    public static readonly OpcodeIndex = 8;
    public static readonly KcpOpcodeIndex = 0;
    public static OpcodeLength = 2;
    public static ActorIdIndex = 0;
    public static ActorIdLength = 8;
    public static MessageIndex = 10;

    public Opcode = 0;
    public ActorId = Long.fromNumber(0);
    public MemoryStream: DataView;
}



export abstract class AChannel {
    public Id = Long.fromNumber(0);

    public ChannelType: ChannelType

    public Error: number

    public RemoteAddress: IPEndPoint


    public get IsDisposed() {
        return this.Id.equals(0);
    }

    public abstract Dispose();
}